import {createWebHistory, createRouter} from "vue-router"
import routes from "./routes"
import useTabsStore from "@/store/tabs"
import path from "path"

let tabsStore:any = undefined

const router = createRouter({
    history: createWebHistory(),
    routes,
})

router.beforeEach((to, from, next) => {
    if (!tabsStore){
        tabsStore = useTabsStore()
    }
    tabsStore.addTab({
        path: to
    })
})

export default router